<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<div id="app">
  <h2 >{{lastname+ ' ' +firstname}}</h2>
  <h1>{{fullname}}</h1>

  <ui>
    <li v-for="book in books">{{book.price}}</li>
  </ui>


  <h2>总价格为：{{totalprice}}</h2>
</div>

<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el:"#app",
    data: {
      message:"stupid mother fucker",
      lastname:'mt',
      firstname:'james',
      books:[
        {id:101,name:'JAVA编程思想',price:75},
        {id:102,name:'JAVA编程思想',price:75},
        {id:103,name:'JAVA编程思想',price:75},
        {id:104,name:'JAVA编程思想',price:75}
      ]
    },
    computed:{
      fullname:function (){
        return (this.lastname+ ' ' +this.firstname)
      },
      totalprice:function (){
        let result=0
        for (let book of this.books){
            result+=book.price
        }
        return result
      }
    }
  })
</script>

</body>
</html>